<?php

use Illuminate\Routing\Router;

Admin::registerAuthRoutes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');


//    ===========================订单相关================================
    $router->group(['namespace' => 'Order', 'prefix' => 'order'], function (Router $router) {
        $router->get('/', 'OrderController@index')->name('index');
        $router->get('/{id}/edit', 'OrderController@edit')->name('edit');
        $router->get('/{id}/create', 'OrderController@create')->name('create');
        $router->post('/api_order/add_state', 'ApiOrderController@add_state')->name('add_state');
        $router->post('/api_order/delete_order', 'ApiOrderController@delete_order')->name('delete_order');
        $router->post('/api_order/close_order', 'ApiOrderController@close_order')->name('close_order');
    });

    //    ===========================用户相关================================
    $router->group(['namespace' => 'User', 'prefix' => 'user'], function (Router $router) {
        $router->get('/', 'UserController@index')->name('index');
        $router->get('/{id}/edit', 'UserController@edit')->name('edit');
        $router->get('/{id}/create', 'UserController@create')->name('create');
        $router->post('/api_user/add_state', 'ApiUserController@add_state')->name('add_state');
        $router->post('/api_user/delete_user', 'ApiUserController@delete_user')->name('delete_user');
        $router->post('/api_user/close_user', 'ApiUserController@close_user')->name('close_user');
    });

    //    ===========================用户相关================================
    $router->group(['namespace' => 'UserAddress', 'prefix' => 'user_address'], function (Router $router) {
        $router->get('/', 'UserAddressController@index')->name('index');
        $router->get('/{id}/edit', 'UserAddressController@edit')->name('edit');
        $router->get('/{id}/create', 'UserAddressController@create')->name('create');
        $router->post('/api_user_address/add_state', 'ApiUserAddressController@add_state')->name('add_state');
        $router->post('/api_user_address/delete_user_address', 'ApiUserAddressController@delete_user_address')->name('delete_user_address');
        $router->post('/api_user_address/close_user_address', 'ApiUserAddressController@close_user_address')->name('close_user_address');
    });

    //    ===========================交易流水相关================================
    $router->group(['namespace' => 'TradingStream', 'prefix' => 'trading_stream'], function (Router $router) {
        $router->get('/', 'TradingStreamController@index')->name('index');
        $router->get('/{id}/edit', 'TradingStreamController@edit')->name('edit');
        $router->get('/{id}/create', 'TradingStreamController@create')->name('create');
        $router->post('/api_trading_stream/add_state', 'ApiTradingStreamController@add_state')->name('add_state');
        $router->post('/api_trading_stream/delete_trading_stream', 'ApiTradingStreamController@delete_trading_stream')->name('delete_trading_stream');
        $router->post('/api_trading_stream/close_trading_stream', 'ApiTradingStreamController@close_trading_stream')->name('close_trading_stream');
    });

//    ===========================商品相关================================
    $router->group(['namespace' => 'Commodity', 'prefix' => 'commodity'], function(Router $router){
        $router->get('/', 'CommodityController@index')->name('index');
        $router->get('/index', 'CommodityController@index')->name('index');
        $router->get('/test', 'CommodityController@test')->name('test');
        $router->get('/commodity','CommodityController@index')->name('index');
        $router->get('/add_commodity','CommodityController@add_commodity')->name('add_commodity');
        $router->post('/api_commodity/add_commodity','ApiCommodityController@add_commodity')->name('add_commodity');
        $router->post('/api_commodity/get_children_commodity','ApiCommodityController@get_children_commodity')->name('get_children_commodity');


//        ======================================商品分类========================================
        $router->get('/classify','ClassifyController@index')->name('index');
        $router->get('/add_classify','ClassifyController@add_classify')->name('add_classify');

        $router->post('/api_classify/get_all_classify','ApiClassifyController@get_all_classify')->name('get_all_classify');
        $router->post('/api_classify/add_classify','ApiClassifyController@add_classify')->name('add_classify');
        $router->post('/api_classify/update_classify','ApiClassifyController@update_classify')->name('update_classify');
        $router->post('/api_classify/get_children_classify','ApiClassifyController@get_children_classify')->name('get_children_classify');
        $router->post('/api_classify/delele_classify','ApiClassifyController@delele_classify')->name('delele_classify');
        $router->post('/api_classify/get_classify','ApiClassifyController@get_classify')->name('get_classify');
//        ======================================商品颜色========================================
        $router->get('/color','ColorController@index')->name('index');
        $router->get('/add_color','ColorController@add_color')->name('add_color');

        $router->post('/api_color/add_color','ApiColorController@add_color')->name('add_color');
        $router->post('/api_color/update_color','ApiColorController@update_color')->name('update_color');
        $router->post('/api_color/get_children_color','ApiColorController@get_children_color')->name('get_children_color');
        $router->post('/api_color/delele_color','ApiColorController@delele_color')->name('delele_color');
        $router->post('/api_color/get_color','ApiColorController@get_color')->name('get_color');
//          ======================================商品尺码========================================
        $router->get('/size','SizeController@index')->name('index');
        $router->get('/add_size','SizeController@add_size')->name('add_size');

        $router->post('/api_size/add_size','ApiSizeController@add_size')->name('add_size');
        $router->post('/api_size/update_size','ApiSizeController@update_size')->name('update_size');
        $router->post('/api_size/get_children_size','ApiSizeController@get_children_size')->name('get_children_size');
        $router->post('/api_size/delele_size','ApiSizeController@delele_size')->name('delele_size');
        $router->post('/api_size/get_size','ApiSizeController@get_size')->name('get_size');
//          ======================================商品信息========================================
        $router->get('/info','InfoController@index')->name('index');
        $router->get('/add_info','InfoController@add_info')->name('add_info');

        $router->post('/api_info/add_info','ApiInfoController@add_info')->name('add_info');
        $router->post('/api_info/update_info','ApiInfoController@update_info')->name('update_info');
        $router->post('/api_info/get_children_info','ApiInfoController@get_children_info')->name('get_children_info');
        $router->post('/api_info/delele_info','ApiInfoController@delele_info')->name('delele_info');
        $router->post('/api_info/get_info','ApiInfoController@get_info')->name('get_info');
    });

});
